local assets = {

	-- Asset("ANIM", "anim/hutao_sfx_pink_flame.zip"),
}


local function fx()
    local inst = CreateEntity()

    inst.entity:AddSoundEmitter()
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()
 
    inst.entity:SetPristine()

    inst:ListenForEvent("animover",inst.Remove)
    if not TheWorld.ismastersim then
        return inst
    end

    inst:ListenForEvent("Set",function(inst,_table)
        -- _table = {
        --     pt = Vector3(0,0,0),
        --     target = inst,
        -- }
        if _table == nil then
            return
        end
        if _table.pt and _table.pt.x then
            inst.Transform:SetPosition(_table.pt.x,_table.pt.y,_table.pt.z)
        end
        if _table.target then
            inst.Transform:SetPosition(_table.target.Transform:GetWorldPosition())
        end
        SpawnPrefab("hutao_sfx_pink_flame_"..math.random(3)).Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst:Remove()
        inst.Ready = true
    end)

    inst:DoTaskInTime(0,function()
        if inst.Ready ~= true then
            inst:PushEvent("Set",{pt = inst.Transform:GetWorldPosition()})
        else                
            inst:Remove()
        end
    end)

    return inst
end

return Prefab("hutao_sfx_pink_flame",fx,assets)